//
// Created by xiaoma on 1/31/21.
//

#ifndef HORSE_VM_CODEOBJECT_H
#define HORSE_VM_CODEOBJECT_H

#include "source/util/ArrayList.h"
#include "source/object/HiObject.h"
#include "source/object/HiString.h"

class CodeObject : public HiObject {
public:
    CodeObject(int argCount, int localCount, int stackSize, int flag, HiString *byteCode, ArrayList<HiObject *> *consts,
               ArrayList<HiObject *> *names, ArrayList<HiObject *> *varNames, ArrayList<HiObject *> *freeVars,
               ArrayList<HiObject *> *cellVars, HiString *fileName, HiString *moduleName, int lineNo,
               HiString *noTable);

    const HiString *getByteCode() const { return _byteCode; }

    int getStackSize() const { return _stackSize; }

    const ArrayList<HiObject *> *getConsts() const { return _consts; }

    const ArrayList<HiObject *> *getNames() const { return _names; }

private:
    int _argCount;
    int _localCount;
    int _stackSize;
    int _flag;
    HiString *_byteCode;
    ArrayList<HiObject *> *_consts;
    ArrayList<HiObject *> *_names;
    ArrayList<HiObject *> *_varNames;
    ArrayList<HiObject *> *_freeVars;
    ArrayList<HiObject *> *_cellVars;
    HiString *_fileName;
    HiString *_moduleName;
    int _lineNo;
    HiString *_noTable;

};

#endif //HORSE_VM_CODEOBJECT_H
